//
//  CelebrityListCell.m
//  ShangHaiTuJI
//
//  Created by xiaoxiangtuji on 2017/7/25.
//  Copyright © 2017年 xiaoxiangtuji. All rights reserved.
//

#import "CelebrityListCell.h"
#import "OpusListModel.h"
@implementation CelebrityListCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}


-(void)setModel:(OpusListModel *)model{
    _model = model;
    UIView *bgview = [[UIView alloc] initWithFrame:self.bounds];
    bgview.backgroundColor = [UIColor whiteColor];
    [self addSubview:bgview];
    UIImageView *imgView = [[UIImageView alloc] init];
    imgView.backgroundColor = [UIColor cyanColor];
    [imgView sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@%@",PictureIp,model.imagepath]] placeholderImage:[UIImage imageNamed:@""]];
    [bgview addSubview:imgView];
    [imgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(bgview.mas_top).offset(cellScaleTopAndBottom(5));
        make.right.equalTo(bgview.mas_right).offset(cellScaleLeftAndRight(-10));
        make.left.equalTo(bgview.mas_left).offset(cellScaleLeftAndRight(10));
        make.height.mas_equalTo(cellScaleTopAndBottom(158));
    }];
    UILabel *titleLabel = [[UILabel alloc] init];
    titleLabel.text = model.name;
    titleLabel.textAlignment = NSTextAlignmentCenter;
    [bgview addSubview:titleLabel];
    [titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(imgView.mas_bottom).offset(cellScaleTopAndBottom(5));
        make.right.equalTo(bgview.mas_right).offset(cellScaleLeftAndRight(-10));
        make.left.equalTo(bgview.mas_left).offset(cellScaleLeftAndRight(10));
        make.bottom.equalTo(bgview.mas_bottom);
    }];

}
-(void)setBiglistModel:(OpusListModel *)biglistModel{
    _biglistModel = biglistModel;
    UIView *bgview = [[UIView alloc] initWithFrame:self.bounds];
    bgview.backgroundColor = [UIColor whiteColor];
    [self addSubview:bgview];
    UIImageView *imgView = [[UIImageView alloc] init];
    imgView.backgroundColor = [UIColor cyanColor];
    [imgView sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@%@",PictureIp,_biglistModel.imagepath]] placeholderImage:[UIImage imageNamed:@""]];
    [bgview addSubview:imgView];
    [imgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(bgview.mas_top).offset(cellScaleTopAndBottom(5));
        make.right.equalTo(bgview.mas_right).offset(cellScaleLeftAndRight(-10));
        make.left.equalTo(bgview.mas_left).offset(cellScaleLeftAndRight(10));
        make.height.mas_equalTo(cellScaleTopAndBottom(158));
    }];
    UILabel *titleLabel = [[UILabel alloc] init];
    titleLabel.text = _biglistModel.authorName;
    titleLabel.textAlignment = NSTextAlignmentCenter;
    [bgview addSubview:titleLabel];
    [titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(imgView.mas_bottom).offset(cellScaleTopAndBottom(5));
        make.right.equalTo(bgview.mas_right).offset(cellScaleLeftAndRight(-10));
        make.left.equalTo(bgview.mas_left).offset(cellScaleLeftAndRight(10));
        make.bottom.equalTo(bgview.mas_bottom);
    }];
}

@end
